﻿using System;
using ZL.Web.Utility.Config;

namespace ZL.Web.Utility.SnowflakeService
{
    public class SnowflakeClient : ServiceBase, ISnowflakeService
    {
        //四版workid都需去掉
        public string GetSno(long workerId, string prefix="")
        {
            workerId = Convert.ToInt64(ZLConfig.WorkerId);
            var url = $"{SnoServer}/Api/Number/GetSno?workerId={workerId}&&prefix={prefix}";
            var info = httpClient.HttpGet<string>(url, Identity);
            return info;
        }

        public long GetId(long workerId)
        {
            workerId = Convert.ToInt64(ZLConfig.WorkerId);
            var url = $"{SnoServer}/Api/Number/GetId?workerId={workerId}";
            var info = httpClient.HttpGet<long>(url, Identity);
            return info;
        }
    }
}
